package com.urbainski.componentes.form
{
	import com.urbainski.componentes.form.MyStatusChangedEvent;

	public class CSMessage
	{
		
		/**
		 * @author Cristian Elder Urbainski
		 * @since 20/12/2011
		 */
		
		private var _type:String;
		private var _description:String;
		
		public static const TYPE_ERROR:String = "ERROR";
		public static const TYPE_INFO:String = "INFO";
		
		public function CSMessage(type:String, message:String = null)
		{
			this._type = type;
			this._description = message;
		}
		
		
		public function get description() : String
		{
			return this._description;
		}
		
		public function get type() : String
		{
			return this._type;
		}
		
		public function toString() : String
		{
			return "[StatusMessage [" + this._type + "] " + this._description + "]";
		}
		
		public function showAsStatus() : void
		{
			CSDispatcher.dispatchEvent(new MyStatusChangedEvent(MyStatusChangedEvent.STATUS_CHANGED, this));
		}
	}
}